import request from "@/utils/request";

// 查询元素信息-模型、数据集列表
export function listElementProvide(query) {
  return request({
    url: "/element/provide/list",
    method: "get",
    params: query,
  });
}

// 查询元素信息-模型、数据集详细
export function getElementProvide(id) {
  return request({
    url: "/element/provide/" + id,
    method: "get",
  });
}

// 新增元素信息-模型、数据集
export function addElementProvide(data) {
  return request({
    url: "/element/provide",
    method: "post",
    data: data,
  });
}

// 修改元素信息-模型、数据集
export function updateElementProvide(data) {
  return request({
    url: "/element/provide",
    method: "put",
    data: data,
  });
}

// 删除元素信息-模型、数据集
export function delElementProvide(id) {
  return request({
    url: "/element/provide/" + id,
    method: "delete",
  });
}

export function getFileList(params) {
  return request({
    url: "/element/file/list",
    method: "get",
    params,
  });
}

export function addFile(data) {
  return request({
    url: "/element/file",
    method: "post",
    data,
  });
}

export function editFile(data) {
  return request({
    url: "/element/file",
    method: "put",
    data,
  });
}

export function removeFile(params) {
  return request({
    url: "/element/file/delete",
    method: "delete",
    params,
  });
}

export function getFileDetail(id) {
  return request({
    url: `/element/file/${id}`,
    method: "get",
  });
}

export function toggleStatus(data) {
  return request({
    url: "/element/provide/updateStatus",
    method: "put",
    data,
  });
}

export function toggleProvideIsTop(data) {
  return request({
    url: "/element/provide/updateRecommendStatus",
    method: "put",
    data,
  });
}

export function toggleFileStatus(data) {
  return request({
    url: "/element/file/updateStatus",
    method: "put",
    data,
  });
}
